<?php

class Parser
{

	protected $_oBrowser = null;

	public function __construct($oBrowser)
	{
		$this->_oBrowser = $oBrowser;
	}

	public function parse(AbstractParser $oParser)
	{
		$html = $this->_oBrowser->get( $oParser->getUrl() );
		
		return $oParser->getData($html);
	}

	public function parseList(AbstractParser $oParser)
	{
		$html = $this->_oBrowser->get( $oParser->getUrl() );

        $items = $oParser->getList($html);

        print_r($items); exit;

		$nextPage = $oParser->getNextPage($html);

        if(!$nextPage)
            return $items;

        $oParser->setUrl($nextPage);
        $this->parseList($oParser);

	}

	

}